package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Println("系统内置字符串函数")
	//字符串的替换
	str1 := strings.Replace("golandjavaandgo", "go", "goland", -1)
	str2 := strings.Replace("golandjavaandgogo", "go", "goland", 2)
	fmt.Println(str1)
	fmt.Println(str2)
	//按照指定的某个字符串，为分隔符，将一个字符串拆分成字符串数组
	arr := strings.Split("go-java-vue", "-")
	fmt.Println(arr)
	//字符串大小写转换
	fmt.Println(strings.ToLower("Go"))
	fmt.Println(strings.ToUpper("Go"))
	//将字符串左右两边的空格去掉
	fmt.Println(strings.TrimSpace(" goland java "))
	//去掉左右指定字符串
	fmt.Println(strings.Trim("~goland~", "~"))
	fmt.Println(strings.TrimLeft("~goland~", "~"))
	//判断字符串是否以指定字符串开头
	fmt.Println(strings.HasPrefix("http://java.sum", "http"))
	
}
